<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
		<link type="text/css" rel="stylesheet" href="./graphics/style1.css">
		<script type="text/javascript" src="js/jquery-1.4.3.js"></script>
		<script src="js/jquery.MultiFile.js" type="text/javascript" language="javascript"></script>
		<script src="js/jquery.form.js" type="text/javascript"></script>
		<script src="js/jquery.tablesorter.min.js" type="text/javascript"></script>
		<script type="text/javascript">
		</script>
		
		<title>Anonymizer For Finnish Documents</title>
	</head>
	<body>
		<div id="kokosivu">
			<div id="navigointipalkki">
				<ul class="valilehdet">
					<li>
						<a href="?p=file_management">Tiedostonhallinta</a>
					</li>
					<!--<li>
						<a href="?p=edit">Muokkaa</a>
					</li>-->
					<li>
						<a href="?p=preferences">Asetukset</a>
					</li>
				</ul>
				<?php
							if(isset($_SESSION['logged'])){
								echo "<span id=\"username\">".$_SESSION['user'].",&nbsp<a id=\"logout\" href=\"?logout\">Kirjaudu ulos</a></span>";
							}
				?>
			</div>
			<div id="runko">

			<?php
				if(isset($_SESSION['logged'])) {
				  if(isset($_GET['logout'])) {
				    session_destroy();
				    header("Location: ./index.php");
				  }
				}
				if(isset($_GET['p']) && $_GET['p'] == "info") {
				  include("./info.php");
				} else {
				if(!isset($_SESSION['logged'])) {
 				  if(isset($_GET['p'])) {
				    $p = $_GET['p'];
				  if($p == "register")
				    include("./register.php");
				  else if($p == "anonymous_login")
				    include("./anonymous_login.php");
				  else
				    include("./login_site.php");
				  }
				  else
				    include("./login_site.php");
				}  else {
				  if(isset($_GET['p'])) {
				    $p = $_GET['p'];
				    if($p == "file_management") {
				      include("./file_management.php");
				    } else if($p == "edit"){
				      include("edit.php");
				    } else if($p == "preferences") {
				      include("./preferences.php");
				    }
	 			  } else {
				   include("./login_site.php");
				  }
				}
				}
				?>
				</div> 
			</div>
		</div>
	</body>
</html>
